﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace stringconversions
{
    public static class StringConversionExtensions
    {
        internal static Dictionary<string, string> CreateDictionary(this IEnumerable<Tuple<Parameter, Value>> settings)
        {
            return StringConversions.CreateDictionary(settings);
        }

        internal static IEnumerable<Tuple<Parameter, Value>> SplitSettingsIntoParamValuePairs(this IEnumerable<Setting> settings)
        {
            return StringConversions.SplitSettingsIntoParamValuePairs(settings);
        }

        internal static IEnumerable<Setting> SplitConfigIntoSettings(this Configuration config)
        {
            return StringConversions.SplitConfigIntoSettings(config);
        }

        public static Dictionary<string, string> ToDictionary(this string configuration)
        {
            return
                new Configuration { Settings = configuration }
                        .SplitConfigIntoSettings()
                        .SplitSettingsIntoParamValuePairs()
                        .CreateDictionary();
        }
    }
}
